import React, { Component } from 'react'
import style from "../components/list.module.css";


// ["view", "price"]
const stateObj = {
    "view": "同兴趣用户看了又看的好货",
    "price": "30天最低价"
}

export class List extends Component {
    render() {
        const { list } = this.props;
        return (
            <div className='list'>
                <ul>
                    {
                        list.length ?
                            list.map(item => {
                                return <li key={item.id}>
                                    <img src={item.img} alt="" />
                                    <p>{item.title}</p>
                                    <p>￥{item.price}元</p>
                                    <p>{item.com}+评论</p>
                                    <p className={style[item.state]}>{stateObj[item.state]}</p>
                                </li>
                            }) : "暂无数据"
                    }
                </ul>

            </div>
        )
    }
}

export default List